<?php

/**
 * Banner form.
 *
 * @package    catalogo
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class BackendBannerForm extends BannerForm
{
  public function configure()
  {
  	parent::configure();
  	
  	$this->removeFields();
  	
  	$this->widgetSchema['banner'] = new sfWidgetFormInputFileEditable(array(
      'label'     => 'Banner',
      'file_src'  => sfConfig::get('app_upload_dir_banner').$this->getObject()->getBanner(),  	
      'is_image'  => false,
      'edit_mode' => !$this->isNew(),
      'template'  => '<div>%file%<br />%input%<br />%delete% Eliminar la imagen actual</div>',
    ));
   
    
		$this->validatorSchema['banner_delete'] = new sfValidatorPass(); 
		$this->validatorSchema['banner'] = new sfValidatorFile(array( 
		    'required' => true, 
		    'path' => sfConfig::get('sf_upload_dir').'/banners', 
		    'mime_types' => sfConfig::get('app_banners_mime_types'), 
		));    
  }
  
  protected function removeFields()
  {
    unset(
      $this['created_at'], $this['updated_at']
    );
  }  
}
